package coms.delegates;

import EJB.EJBLocator;
import coms.dto.Conference;
import coms.ejb.ConferenceBeanRemote;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class ConferenceDelegate implements IDelegate<Conference> {

    private ConferenceBeanRemote conferenceBean;
    
    public ConferenceDelegate() {
        try {
            this.conferenceBean = EJBLocator.lookupConferenceBean();
        } catch (Exception ex) {
            Logger.getLogger(ConferenceDelegate.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public boolean create(Conference conference) {
        conferenceBean.create(conference);
        return true;
    }

     @Override
    public boolean delete(Conference conference) {
        boolean deleted = conferenceBean.delete(conference);
        return deleted;
    }

     @Override
    public boolean update(Conference conference) {
        conferenceBean.update(conference);
        return true;
    }

    @Override
    public List<Conference> search(Conference conference) throws Exception {
        return conferenceBean.search(conference);
    }

    @Override
    public List<Conference> findAll(){
        return conferenceBean.findAll();
    }

    @Override
    public Conference getById(int id) {
       return conferenceBean.getById(id);
    }
}
